package com.sql;

import java.sql.*;

public class Conn {

	protected static ConnectionPool pc = new ConnectionPool();

	public static void init() {
		if (pc == null)
			pc = new ConnectionPool();
		else
			pc.init();
	}

	public static void start() {
		if (pc == null)
			pc = new ConnectionPool();
		else
			pc.start();
	}

	public static int getSize() {
		if (pc == null)
			pc = new ConnectionPool();

		return pc.getSize();
	}

	public static int getUsed() {
		if (pc == null)
			pc = new ConnectionPool();

		return pc.getUseCount();
	}

	public static void destroy() {
		if (pc == null)
			pc = new ConnectionPool();
		else
			pc.destroy();
	}

	public static void restart() {
		if (pc == null)
			pc = new ConnectionPool();
		else
			pc.restart();
	}

	public static Connection getConnection() throws SQLException {
		if (pc == null || pc.connectionPool == null)
			pc = new ConnectionPool();

		return pc.getConnection();
	}

}